package org.bee.listener;

import jakarta.annotation.Resource;
import org.bee.controller.NoticeController;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class QueueReceiver {

    private final NoticeController noticeController;

    public QueueReceiver(NoticeController noticeController) {
        this.noticeController = noticeController;
    }

    @RabbitListener(queues= "noticeQueue")
    public void receiveNotice(String noticeMessage) {
        System.out.println("接收到消息：" + noticeMessage);
        noticeController.send(noticeMessage);
    }
}
